﻿<% 
	response.setHeader("Pragma","No-cache");
	response.setHeader("Cache-Control","no-cache");
	response.setDateHeader("Expires", 0);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link
	href="${pageContext.request.contextPath}/views/js/ligerUI/skins/Aqua/css/ligerui-all.css"
	rel="stylesheet" type="text/css" />
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<script
	src="${pageContext.request.contextPath}/views/js/ligerUI/js/core/base.js"
	type="text/javascript"></script>
<script
	src="${pageContext.request.contextPath}/views/js/ligerUI/js/plugins/ligerTree.js"
	type="text/javascript"></script>
<script type="text/javascript">
	var tree = null;
	var dialog = frameElement.dialog;
	$(function() {
		tree = $("#tree1")
				.ligerTree(
						{
							url : '${pageContext.request.contextPath}/admin-department/selectdepartmenttree',
							ajaxType : 'get',
							checkbox :false,
							onSelect : onSelect,
							isExpand : 2
						});
	});
	function onSelect(note)
    {
		parent.window.setDepart(note.data.id,note.data.text,note.data.level);
        dialog.close();//关闭dialog 
    }
	function f_selectNode() {
		/* var parm = function(data) {
			return data.text.indexOf('节点1.3') == 0;
		};
		tree.selectNode(parm); */
		var a = tree.getSelected();
		if(a){
			//alert(a.data.text+"*"+a.data.id);
			parent.window.setDepart(a.data.id,a.data.text,a.data.level);
            dialog.close();//关闭dialog 
		}else{
			alert("请选择部门");
		}
	}
	
	

	function f_cancelSelect() {
		var parm = function(data) {
			return false;
		};

		tree.selectNode(parm);
	}
</script>
</head>
<body style="padding: 10px">
<!-- 
	<div>
		<a class="l-button"
			style="width: 120px; margin-left: 10px; float: left;"
			onclick="f_selectNode()">确认选择</a>
	</div>
 -->
	<div
		style="width: 300px; height: 370px; margin: 10px; float: left; clear: both; border: 1px solid #ccc; overflow: auto;">


		<ul id="tree1" ></ul>
	</div>

	<div style="display: none"></div>
</body>
</html>
